<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<%@  include file="connstring.jsp" %>
<%
 request.setCharacterEncoding("UTF-8");
String strXm=request.getParameter("xm");
String strPh=request.getParameter("ph");
String strCs=request.getParameter("cs");
String strDz=request.getParameter("dz");
String strBz=request.getParameter("bz");
if(strXm==null) strXm="";
if(strPh==null) strPh="";
if(strCs==null) strCs="";
if(strDz==null) strDz="";
if(strBz==null) strBz="";
if(strXm.equals("")||strPh.equals("")||strCs.equals("")||strDz.equals("")||strBz.equals("")) {
%>

<script type="text/javascript">
alert('姓名,手机号码,城市,详细地址,备注必须填写！\n请重试。');
history.go(-1);
</script>
<%
}
else
{
Connection conn=null;
Statement stmt=null;
try{
	Class.forName(driver);
	conn= DriverManager.getConnection(url);	
	 stmt=conn.createStatement();
	 String sql="insert into three_user(name,phone,city,address,remark)"
			+"values('"+strXm+"','"+strPh+"','"+strCs+"','"+strDz+"','"+strBz+"')";
   stmt.executeUpdate(sql);
   response.sendRedirect("newslist.jsp");
}
catch(Exception ex){
	out.print("错误："+ex.getMessage());
}
finally{
	
	if(conn!=null)  conn.close();
	if(stmt!=null)  stmt.close();
}    
}

%>

    